import request from '../../utils/request';


// 获取角色列表
export function getRoleList (params){
    return request({
        url:"/sys/role/findRoleListByPage.do",
        method: 'POST',
        data: params,
        headContype:true
    });
};

// 获取角色列表-(得到指定用户分配的角色)
export function getSelectRoleList (params){
    return request({
        url:"/sys/user/getSelectRoleList.do",
        method: 'POST',
        params: params,
        headContype:true
    });
};


// 获取角色授权列表
export function getRoleTreeList (params){
    return request({
        url:"/sys/menu/getSelectMenuTree.do",
        method: 'post',
        params: params
    });
};


// 新增角色检查角色编码是否存在
export function validateRoleCode (params){
    return request({
        url:"/sys/role/roleIdExist.do",
        method: 'get',
        params: params
    });
};


// 新增帐号角色
export function addAccountRole (params){
    return request({
        url:"/sys/role/addUserRoles.do",
        method: 'post',
        data: params,
        headContype:true
    });
};


// 修改帐号角色
export function editUserRoles (params){
    return request({
        url:"/sys/role/editUserRoles.do",
        method: 'post',
        data: params,
        headContype:true
    });
};



// 新增角色
export function addRole (params){
    return request({
        url:"/sys/role/add.do",
        method: 'post',
        data: params,
        headContype:true
    });
};


// 编辑角色
export function editRole (params){
    return request({
        url:"/sys/role/edit.do",
        method: 'post',
        data: params,
        headContype:true
    });
};


// 删除单个角色
export function deleteSigleRole (params){
    return request({
        url:'/sys/role/delete.do',
        method: 'DELETE',
        params: params
    });
};

// 查看角色编辑数据
export function editRoleDetail (params){
    return request({
        url:window.poIP+ "/auth/role/"+params.id,
        method: 'get',
        params: params
    });
};
// 角色授权查询
export function roleTreeMenu (params){
    return request({
        url:"/sys/menu/getSelectMenuTree.do",
        method: 'post',
        params: params
    });
};

// 角色授权菜单保存
export function saveRoleTreeMenu (params){
    return request({
        url:"/sys/role/editRoleMenus.do",
        method: 'post',
        data: params,
        headContype:true
    });
};


// 获取流程 角色列表
export function getFlowSelectRoleList (params){
    return request({
        url:"/sys/role/findLoanFlowRoleList.do",
        method: 'POST',
        params: params,
        headContype:true
    });
};

export function getWebRoleList (params){
    return request({
        url:"/sys/role/findBizRoleList.do",
        method: 'post',
        params: params
    });
};
